<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>给展示的内容添加默认值</title>
</head>

<body>


  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <div id="Application">
    <input type="text" v-model="mesage" />
    <h2>您输入的内容是：{{mesage ?? msg}}</h2>
    <button @click="mesage = ''">清空</button>
  </div>
  <script>
    const App = Vue.createApp({
      setup() {
        const mesage = Vue.ref();
        const msg = Vue.ref("默认值");
        return {
          mesage,
          msg,
        };
      },
    });
    App.mount("#Application");
  </script>
</body>

</html>